<!DOCTYPE html>
<html ng-app="app">

	<head>
		<meta charset="utf-8">
		<title>angular model</title>
		<script type="text/javascript" src="js/jqury.js"></script>
		<script type="text/javascript" src="js/angular.js"></script>

	</head>

	<body ng-controller="PhoneListCtrl">
		Search:
		<input ng-model="query">
		<!--
        	作者：soyesman@163.com
        	时间：2015-08-25
        	描述：过滤指定字段值
        -->
		<ul>
			<li ng-repeat="phone in phones | filter:{name: query}">
				{{phone.name}}
				<p>{{phone.snippet}}</p>
				<p>{{phone.age}}</p>

			</li>
		</ul>
		<!--
$http({
    method:'post',
    url:'post.php',
    data:{name:"aaa",id:1,age:20},
    headers:{'Content-Type': 'application/x-www-form-urlencoded'},
    transformRequest: function(obj) {
      var str = [];
      for(var p in obj){
        str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
      }
      return str.join("&");
    }
 }).success(function(req){
        console.log(req);
 })
-->
		<script type="application/javascript">
			var myApp = angular.module('app', []);
			 //需要注入$http
		
			 myApp.controller('PhoneListCtrl', PhoneListCtrl);

			function PhoneListCtrl($scope, $http) {
				$http.post("http://127.0.0.1/web/angular/php/phonesPost2.php", {
					"uid": "xx"
				}).success(function(data) {
					$scope.phones = data;
				}).error(function(data, status, headers, config) {
					console.log(data);
				});
			}
		</script>
	</body>

</html>